package com.hz.house.scheduled;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.hz.house.cache.HomePageCacheService;
import com.hz.house.service.CommonService;

@Component
public class AllTaskScheduled {

	@Autowired
	private CommonService commonService;
	
	@Autowired
	private HomePageCacheService homePageCacheService;
	
	/**每小时更新一次小程序的apitoken*/
	@Scheduled(cron = "5 0 * * * ?")
	public void updateMiniprogramAcctk() {
		this.commonService.getWxMiniProgramAcctk();
		this.commonService.getBaiDuApiAcctk();//跟新百度api toekn
	}
	
	@Scheduled(cron = "0 0 0 * * ?")
	public void deleteCaches() {
		homePageCacheService.deleteGoldenSaleManV2_1();
		homePageCacheService.deleteGoldenSaleManV2_2();
	}
}
